#ifndef BOOK_T_H
#define BOOK_T_H

#include <string>
#include <list>

using namespace std;

typedef long isbn_t;
class Borrower_t;

class Book_t {

	friend ostream &operator<< (ostream& os, const Book_t & book);

private:
	Book_t(const Book_t & book); // copying a book is unavailable... because it's called "plagiarism"...
	Book_t & operator= (const Book_t & book); // assignment of book is unavailable

	string name_;
	string author_;
	isbn_t isbn_;

	int num_of_copies_;
	int num_of_borrowed_copies_; //Should remember or calculate each time?

	list<const Borrower_t *> borrowers_;
	list<const Borrower_t *> waiting_borrowers_;

public:

	~Book_t() {};
	Book_t(const string & name, const string & author, const isbn_t & isbn, const int & num_of_copies) \
		: name_(name), author_(author), isbn_(isbn), num_of_copies_(num_of_copies) {num_of_borrowed_copies_ = 0;};


	inline const string & getName() const { return name_; }
	inline const string & getAuthor() const { return author_; }
	inline const isbn_t & getIsbn() const { return isbn_; }

	inline bool isAvailable() const { return ((num_of_copies_ - num_of_borrowed_copies_) > 0); }
	inline const int & getNumOfCopies() const { return num_of_copies_; }
	inline const int & getNumOfBorrowedCopies() const { return num_of_borrowed_copies_; }

	bool borrow(const Borrower_t * borrower);
	const Borrower_t * returnCopy(const Borrower_t * borrower);
};

#endif